export const FormDesignMixin = {
  data () {
    return {};
  },
  created () {

  },
  methods: {
    fieldLengthConfig (item) {
      const { __config__, __vModel__ } = item;
      __config__.fieldLength = 500;
      switch (__config__.tagIcon) {
        case 'textarea':
          __config__.fieldLength = 2000;
          break;
        case "number":
          __config__.bindTableFieldType = "double";
          __config__.fieldLength = 20;
        break;
        case 'rich-text':
          __config__.bindTableFieldType = 'varchar'
          __config__.fieldLength = 5000
          break;
        case 'checkbox':
          __config__.fieldLength = 500;
          break;
        case 'switch':
          __config__.bindTableFieldType = 'int'
          break;
        case 'slider':
          __config__.bindTableFieldType = 'int'
          __config__.fieldLength = 20;
          break;
        case 'time':
          __config__.bindTableFieldType = 'varchar'
          break;
        case 'date':
          __config__.bindTableFieldType = 'datetime'
          break;
        case 'rate':
          __config__.bindTableFieldType = 'double'
          __config__.fieldLength = 20;
          break;
        case 'color':
          __config__.fieldLength = 25
          break;
        case 'image':
          __config__.fieldLength = 500
          break;
          case 'upload':
            __config__.fieldLength = 2000
            break;
          case 'xjr-select-user':
            __config__.fieldLength = 5000
          break;
      }
      //编码
      if(__config__.avueType=="autoCode"){
        __config__.fieldLength = 100
      }
      if(__config__.tag=="el-mutiple-input"){
        __config__.fieldLength = 2000;
      }
      return {
        fieldName: __vModel__ || '',
        dataType: __config__.bindTableFieldType || 'varchar',
        describe: __config__.label || '',
        formId: __config__.formId,
        fieldLength: __config__.fieldLength || 50,
        componentName: __config__.componentName || '',
        $cellEdit: true
      };

    }
  }
};

